<template>
  <div id="login_box">
    <div id="login">
      <h2>LOGIN</h2>
      <div id="input_box">
        <input
          type="text"
          v-model="loginparam.account"
          placeholder="请输入用户名"
        />
      </div>
      <div class="input_box">
        <input
          type="password"
          v-model="loginparam.password"
          placeholder="请输入密码"
        />
      </div>
      <button @click="login">登录</button><br />
    </div>
  </div>
</template>

<script>
import { Login } from "@/api/index";
// import { getAction } from "@/utils/http1";

export default {
  data() {
    return {
      loginparam: {
        account: "",
        password: "",
      },
    };
  },
  mounted() {},
  methods: {
    login() {
      if (this.loginparam.account == "" || this.loginparam.password == "") {
        this.$message.warning("账号密码不能为空");
      } else {
        Login("/login", { params: this.loginparam }).then((res) => {
          if (res.data) {
            setInterval(() => {
              console.log("十秒执行一次");
            }, 10000);
            this.$router.push("/home");
          } else {
            this.$message.warning("请输入正确的账号密码");
          }
        });
      }
    },
    cancel() {
      getAction("/login").then((res) => {
        console.log(res);
      });
    },
  },
};
</script>

<style lang="scss" scoped>
#login_box {
  width: 100%;
  height: 100%;
  background: url("../../assets/back.jpg") no-repeat;
  background-size: 100%;
  display: flex;
  justify-content: center;

  #login {
    width: 20%;
    height: 400px;
    background-color: #00000060;
    margin: auto;
    text-align: center;
    border-radius: 10px;
    padding: 50px 50px;
    h2 {
      color: #ffffff90;
      margin-top: 5%;
    }
    #input-box {
      margin-top: 5%;
    }
    input {
      border: 0;
      width: 60%;
      font-size: 15px;
      color: #fff;
      background: transparent;
      border-bottom: 2px solid #fff;
      padding: 5px 10px;
      outline: none;
      margin-top: 10px;
    }

    button {
      margin-top: 50px;
      width: 60%;
      height: 30px;
      border-radius: 10px;
      border: 0;
      color: #fff;
      text-align: center;
      line-height: 30px;
      font-size: 15px;
      background-image: linear-gradient(to right, #30cfd0, #330867);
    }
  }
}
</style>


